
import threading

from module.data.SimulaterMonitor import SimulaterMonitor

import logging
log = logging.getLogger("tasklog")

class StrategyThread(threading.Thread):
    def __init__(self, taskcenter):
        threading.Thread.__init__(self)
        self.taskCenter = taskcenter

    def run(self):
        optionDetail = self.taskCenter[0]
        queuename = optionDetail['uuid']

        code = optionDetail['code'][0]
        O_name = optionDetail['o_name'][0]
        taskid = optionDetail['taskid']
        acc_id = taskid.split('&&&')[1]
        TrdEnv = optionDetail['TrdEnv'][0]
        log.info("任务启动短线策略监控线程: 短线配置-%s taskid-%s 环境%s" % (optionDetail, taskid,TrdEnv))
        realMonitor = SimulaterMonitor(queue=queuename, shortList=[(code, O_name, acc_id,0)], TrdEnv=TrdEnv)
        realMonitor.start()